package com.mashang.util;

import java.util.List;

public class ResultView<T> {

    private Integer code = 200;

    private String msg = "操作成功!";

    private List<T> rows;

    private Integer total;

    private T data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static ResultView successData(Object data) {
        ResultView resultView = new ResultView();
        resultView.setData(data);
        return resultView;
    }

    public static ResultView success() {
        ResultView resultView = new ResultView();
        return resultView;
    }

    public static ResultView fail(Integer code, String msg) {
        ResultView resultView = new ResultView();
        resultView.setCode(code);
        resultView.setMsg(msg);
        return resultView;
    }

}
